package com.bite.MostWaterContainer;

public class Demo {
    public int maxArea(int[] height) {
        int left = 0;
        int right = height.length - 1;
        int n = height.length;
        int maxV = 0;
        while (left < right) {
            int V = (right - left) * Math.min(height[right] , height[left]);
            if (V > maxV) maxV = V;
            if (height[left] <= height[right]) left++;
            else right--;
        }
        return maxV;
    }
}
